package cn.supermaster.management.web.controller.system;

import cn.supermaster.management.web.service.system.ISUserService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import cn.supermaster.management.common.controller.BaseController;

/**
 * All rights Reserved, Designed By www.super-bytecode.com
 *
 * @ProjectName: supermaster-management
 * @Package: cn.supermaster.management.web.controller.system
 * @ClassName: SystemUserController
 * @Description: [用户信息]
 * <p> </p>
 * @Author: [Lance Ting]
 * @Date: 2021/1/11 3:45
 * @Version: V1.0
 * @Copyright: 2021 www.super-bytecode.comn Inc. All rights reserved.
 * TODO: 注意,本文件Lance Ting所作,如果转载或使用请标明具体出处!
 **/
@Controller
@RequestMapping("/system/user")
public class SystemUserController extends BaseController {
    @Autowired
    private ISUserService userService;

    @RequiresPermissions("system:user:view")
    @GetMapping()
    public String skipUserIndexHtml() {
        return userService.skipUserIndexHtml();
    }

    /**
     * 新增用户
     */
    @GetMapping("/add")
    public String skipAddUserHtml(ModelMap modelMap) {
        return userService.skipAddUserHtml(modelMap);
    }

    /**
     * 修改用户
     */
    @GetMapping("/edit/{userId}")
    public String skiModifyUserHtml(ModelMap modelMap, @PathVariable("userId") Long userId) {
        return userService.skiModifyUserHtml(modelMap, userId);
    }

    // 修改用户密码
    @RequiresPermissions("system:user:resetPwd")
    @GetMapping("/resetPwd/{userId}")
    public String resetPwd(@PathVariable("userId") Long userId, ModelMap modelMap) {
        return userService.skiResetPasswordHtml(modelMap, userId);
    }

    /**
     * 进入授权角色页
     */
    @GetMapping("/authRole/{userId}")
    public String skipAuthRoleHtml(ModelMap modelMap, @PathVariable("userId") Long userId) {
        return userService.skipAuthRoleHtml(modelMap, userId);
    }
}